Skip to content

test: cover TCP demand after peer write closure - #3817

Merged
He-Pin merged 1 commit into
apache:mainfrom
He-Pin:test/tcp-demand-after-peer-write-closure
Nov 29, 2026
Merged

He-Pin merged 1 commit into
apache:mainfrom
He-Pin:test/tcp-demand-after-peer-write-closure

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 27, 2026

Copy link
Copy Markdown
Member

Motivation

Existing TCP half-close tests request the response before the peer has closed its write side. A subscriber can first request data after the peer has completed its writes.

Modification

Use a loopback peer on an OS-assigned port. After the client closes its write side, require the peer to acknowledge its final write and write-side closure before issuing the first application demand for the reply. Check the exact data and completion.

Result

Covers this normal TCP lifecycle without timing sleeps or runtime changes. The test makes no assertion about when the client kernel receives the FIN or about internal prefetch.

Tests

The single focused TcpSpec case passed on both Scala 2.13.18 and 3.3.9 with JDK 17. Scoped test formatting and license checks passed.

References

Netty 5.0 and 4.2 SocketHalfClosedTest data-drain coverage informed this independently written test.

Motivation:
Existing TCP half-close tests consume the peer's final data before
waiting for the peer to close. A subscriber may first request that
data after the peer has completed its writes.

Modification:
Use an OS-assigned loopback port, observe the client's write-side
closure, and wait for the peer's write and close acknowledgements
before requesting the reply. Check the exact data and completion.
Clean up the subscriber, listener and registered peer independently.

Result:
The native TCP test covers application demand after peer output
closure. No runtime behavior or public API changes.

Tests:
- Stock sbt: the focused TcpSpec case passed on Scala 2.13.18 and 3.3.9
  with JDK 17.
- stream-tests Test scalafmtCheck, headerCheck and git diff --check passed.

References:
Netty 5.0 and 4.2 SocketHalfClosedTest data-drain coverage, used as
behavioral comparison only. No upstream source copied.
@He-Pin
He-Pin marked this pull request as ready for review November 27, 2026 19:47
@He-Pin
He-Pin requested a review from pjfanning November 27, 2026 19:47

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@He-Pin
He-Pin merged commit 0055dce into apache:main Nov 29, 2026
11 checks passed
@He-Pin
He-Pin deleted the test/tcp-demand-after-peer-write-closure branch November 29, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants